package com.braveman.im.ui.adapter;


import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.braveman.im.R;
import com.braveman.im.bean.CardBean;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qmuiteam.qmui.widget.QMUIRadiusImageView;

import java.util.List;

/**
 * Created by 昊昊 on 2017/10/12.
 */

/**
 * 名片适配
 */
public class CardAdapter extends BaseQuickAdapter<CardBean.DataListBean, BaseViewHolder> {
    private QMUIRadiusImageView qmuiRadiusImageView;

    public CardAdapter(@LayoutRes int layoutResId, @Nullable List<CardBean.DataListBean> data) {
        super(R.layout.item_mine_card, data);
    }

    // TODO: 2017/11/3 实现点击自定义布局的点击事件
    @Override
    protected void convert(BaseViewHolder helper, CardBean.DataListBean item) {
        qmuiRadiusImageView = helper.getView(R.id.img_head);
        qmuiRadiusImageView.setCircle(false);
        helper.setText(R.id.tv_name, item.name)
                .setText(R.id.tv_duty, item.position)
                .setText(R.id.tv_ours, item.corpName)
                .addOnClickListener(R.id.tv_item_mine_card_phone_num)
                .addOnClickListener(R.id.tv_item_mine_card_share)
                .addOnClickListener(R.id.tv_item_mine_card_compile);
        Glide.with(mContext).load(item.avatar).into(qmuiRadiusImageView);
    }
}
